// 查询参数
export interface queryParams {
    pageNum: number;
    pageSize: number;
}

// 查询参数
export interface btnObj {
    name: string;
    iconName: string;
    perms: string;
    isPlain: boolean;
}

// 查询参数
export interface reset {
    reset: boolean;
}

// 添加角色吧表单验证规则
export const addRoleFromRules = reactive({
    type_name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
    describe: [{ required: true, message: "请输入角色描述", trigger: "blur" }],
});

// 工具列表
export const btnList: Array<btnObj> = [
    {
        name: "添加角色",
        iconName: "user",
        perms: "sys:user:addRole",
        isPlain: false,
    },
];

export const tableHead = reactive([
    {
        prop: "id",
        label: "ID",
    },
    {
        prop: "type_name",
        label: "角色名称",
    },

    {
        prop: "describe",
        label: "角色描述",
    },
    {
        prop: "user_total",
        label: "角色数量",
    },
    {
        prop: "status",
        label: "状态",
    },
    {
        prop: "create_time",
        label: "创建时间",
    },
    {
        prop: "",
        label: "操作",
        width: "220",
        align: "center",
    },
] as any);

export const roleInfoMap = [
    {
        label: "角色名称",
        key: "type_name",
        width: "100%",
    },
    {
        label: "角色描述",
        key: "describe",
        width: "100%",
    },
];

const permissionInMap = [
    {
        label: "是否为管理员",
        key: "is_admin",
        width: "100%",
    },
    {
        label: "当前",
        key: "count",
        width: "100%",
    },
];
const createdInMap = [
    {
        label: "创建时间",
        key: "create_time",
    },
    {
        label: "创建人",
        key: "create_username",
    },
    {
        label: "最近修改时间",
        key: "update_time",
    },
];
const infoMap = new Map([
    ["角色信息", roleInfoMap],
    ["权限信息", permissionInMap],
    ["创建信息", createdInMap],
]);
export const formTitleList = Array.from(infoMap.keys());
export const getInfoList = (
    data: any,
    nameSting: "角色信息" | "权限信息" | "创建信息"
) => {
    let keyList = infoMap.get(nameSting);
    return keyList!.map((item: any) => {
        return {
            label: item.label,
            value: data[item.key],
            width: item.width,
        };
    });
};
